package com.zimin.cloud.user.service.impl;

import com.zimin.cloud.mine.pojo.user.view.FollowingGroupVO;
import com.zimin.cloud.user.pojo.entity.FollowingGroup;
import com.zimin.cloud.user.mapper.FollowingGroupMapper;
import com.zimin.cloud.user.service.IFollowingGroupService;
import com.zimin.mapper.injector.InjectServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户关注分组表 服务实现类
 * </p>
 *
 * @author zimin
 * @since 2022-06-14 15:53
 */
@Service("followingGroupService")
public class FollowingGroupServiceImpl extends InjectServiceImpl<FollowingGroupMapper, FollowingGroup> implements IFollowingGroupService {

    @Override
    public FollowingGroupVO getByType(String type) {
        return getOne(lambdaQuery().eq(FollowingGroup::getType, type), FollowingGroupVO.class);
    }

    @Override
    public List<FollowingGroupVO> getByUserId(String userId) {
        return list(lambdaQuery()
                .eq(FollowingGroup::getUserId, userId)
                .or().in(FollowingGroup::getType, "0", "1", "2"), FollowingGroupVO.class);
    }

}
